﻿/****** Object:  UserDefinedFunction [dbo].[FormatString0]    Script Date: 05/23/2009 23:44:27 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString0]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[FormatString0]
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString1]    Script Date: 05/23/2009 23:44:27 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString1]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[FormatString1]
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString2]    Script Date: 05/23/2009 23:44:28 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString2]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[FormatString2]
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString3]    Script Date: 05/23/2009 23:44:28 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString3]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[FormatString3]
GO
/****** Object:  SqlAssembly [Fotia.SqlClr]    Script Date: 05/23/2009 23:44:27 ******/
IF  EXISTS (SELECT * FROM sys.assemblies asms WHERE asms.name = N'Fotia.SqlClr' and is_user_defined = 1)
DROP ASSEMBLY [Fotia.SqlClr]
GO
/****** Object:  SqlAssembly [Fotia.SqlClr]    Script Date: 05/23/2009 23:44:27 ******/
IF NOT EXISTS (SELECT * FROM sys.assemblies asms WHERE asms.name = N'Fotia.SqlClr' and is_user_defined = 1)
CREATE ASSEMBLY [Fotia.SqlClr]
AUTHORIZATION [dbo]
FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C010300F07B184A0000000000000000E00002210B010800000E000000060000000000003E2D0000002000000040000000004000002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000EC2C00004F000000004000002803000000000000000000000000000000000000006000000C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E74657874000000440D000000200000000E000000020000000000000000000000000000200000602E7273726300000028030000004000000004000000100000000000000000000000000000400000402E72656C6F6300000C0000000060000000020000001400000000000000000000000000004000004200000000000000000000000000000000202D000000000000480000000200050010230000DC09000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001330040032000000010000110F00280F00000A2D230F00281000000A178D010000010A061603A2062805000006281100000A281200000A2A7E1300000A2A00001330040036000000010000110F00280F00000A2D270F00281000000A188D010000010A061603A2061704A2062805000006281100000A281200000A2A7E1300000A2A0000133004003A000000010000110F00280F00000A2D2B0F00281000000A198D010000010A061603A2061704A2061805A2062805000006281100000A281200000A2A7E1300000A2A0000133004003F000000010000110F00280F00000A2D300F00281000000A1A8D010000010A061603A2061704A2061805A206190E04A2062805000006281100000A281200000A2A7E1300000A2A4E0214FE0606000006731400000A280100002B2A00133001007E010000020000110275140000010A062C08066F1600000A2C02142A0275020000012C0F02A5020000010B1201281000000A2A0275150000012C1402A5150000010C1202281700000A8C160000012A0275170000012C1402A5170000010D1203281800000A8C180000012A0275190000012C1502A51900000113041204281900000A8C1A0000012A02751B0000012C1502A51B00000113051205281A00000A8C1C0000012A02751D0000012C1502A51D00000113061206281B00000A8C1E0000012A02751F0000012C1502A51F00000113071207281C00000A8C200000012A0275210000012C1502A52100000113081208281D00000A8C220000012A0275230000012C1502A52300000113091209281E00000A8C220000012A0275240000012C1502A524000001130A120A281F00000A8C250000012A0275260000012C1502A526000001130B120B282000000A8C270000012A0275280000012C1502A528000001130C120C282100000A8C290000012A02752A0000012C0C02742A0000016F2200000A2A022A1E02282300000A2A000042534A4201000100000000000C00000076322E302E35303732370000000005006C000000A4030000237E000010040000E803000023537472696E677300000000F807000008000000235553000008000010000000234755494400000010080000CC01000023426C6F620000000000000002000001471502080908000000FA013300160000010000002A000000020000000700000010000000230000000F000000020000000100000001000000020000000100000000000A00010000000000060045003E000A006D005800060002013E0006002801160106003F01160106005C01160106007B0116010600940116010600AD0116010600C80116010600E301160106001B02FC0106002F0216010600680248020600880248020A00C102A6020600EB023E0006000A033E00060016033E000A00270358000A003103580006003A033E000A0040035800060049033E000A004F035800060058033E000A005E035800060068033E000A006F035800060079033E000A008003580006008C033E000A009503580006009E033E000A00A60358000A00B10358000600BC033E000A00C40358000600CC033E000A00D10358000600D9033E000A00DE0358000000000001000000000001000100010010001B002800050001000100502000000000960077000A0001009020000000009600850012000300D42000000000960093001B0006001C21000000009600A10025000A006721000000009100AF0030000F007C21000000009100C000370010000623000000008618D8003C00110000000100DE0000000200E50000000100DE0000000200E50000000300EA0000000100DE0000000200E50000000300EA0000000400EF0000000100DE0000000200E50000000300EA0000000400EF0000000500F40000000100F90000000100F9001900D8003C002100D80045002900D80045003100D80045003900D80045004100D80045004900D80045005100D80045005900D80045006100D8004A006900D80045007100D8004F007900D8003C008100D8003C001100D602E5001100E102E9008900F202ED001100F902F40011000503FA000C00D8000A0199001C031001A100D602E500A900E1022701B900E1022B01C900E1022F01D900E1023301E900E1023701F900E1023B010901E10241011901E10241012101E102E5003101E10247014101E1024B015101E102E9000900D8003C002000730054002E00230085012E002B0085012E006B00AC012E00130073012E001B0085012E00330073012E003B008B012E00430085012E00530085012E006300A301400073005400600073005400800073005400E4010B004000FE005101030104800000010000000000000000000000000028000000020000000000000000000000010035000000000002000000000000000000000001004C00000000002B00220100000000003C4D6F64756C653E00466F7469612E53716C436C722E646C6C00466F726D6174537472696E6700466F7469612E53716C436C72006D73636F726C69620053797374656D004F626A6563740053797374656D2E446174610053797374656D2E446174612E53716C54797065730053716C537472696E6700466F726D6174537472696E673000466F726D6174537472696E673100466F726D6174537472696E673200466F726D6174537472696E67330053716C54797065546F4E65745479706500436F6E7665727453716C54797065546F4E657454797065002E63746F7200666F726D617400617267300061726731006172673200617267330073716C56616C756500506172616D41727261794174747269627574650053797374656D2E5265666C656374696F6E00417373656D626C795469746C6541747472696275746500417373656D626C794465736372697074696F6E41747472696275746500417373656D626C79436F6E66696775726174696F6E41747472696275746500417373656D626C79436F6D70616E7941747472696275746500417373656D626C7950726F6475637441747472696275746500417373656D626C79436F7079726967687441747472696275746500417373656D626C7954726164656D61726B41747472696275746500417373656D626C7943756C747572654174747269627574650053797374656D2E52756E74696D652E496E7465726F70536572766963657300436F6D56697369626C6541747472696275746500417373656D626C7956657273696F6E4174747269627574650053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300436F6D70696C6174696F6E52656C61786174696F6E734174747269627574650052756E74696D65436F6D7061746962696C697479417474726962757465004D6963726F736F66742E53716C5365727665722E5365727665720053716C46756E6374696F6E417474726962757465006765745F49734E756C6C006765745F56616C756500537472696E6700466F726D6174006F705F496D706C69636974004E756C6C00436F6E766572746572603200417272617900436F6E76657274416C6C00494E756C6C61626C650053716C496E74313600496E7431360053716C496E74333200496E7433320053716C496E74363400496E7436340053716C53696E676C650053696E676C650053716C446F75626C6500446F75626C650053716C4461746554696D65004461746554696D650053716C4D6F6E657900446563696D616C0053716C446563696D616C0053716C426F6F6C65616E00426F6F6C65616E0053716C4279746500427974650053716C4775696400477569640053716C586D6C000000000003200000000000598EF1F5A618124F93AE89112244D6320008B77A5C561934E089070002110911091C080003110911091C1C090004110911091C1C1C0A0005110911091C1C1C1C0600011D1C1D1C0400011C1C032000010401000000042001010E04200101020420010108808F010001005455794D6963726F736F66742E53716C5365727665722E5365727665722E446174614163636573734B696E642C2053797374656D2E446174612C2056657273696F6E3D322E302E302E302C2043756C747572653D6E65757472616C2C205075626C69634B6579546F6B656E3D623737613563353631393334653038390A4461746141636365737300000000032000020320000E0600020E0E1D1C05000111090E030611090407011D1C06151249021C1C052002011C18111002021D1E011D1E00151249021E001E01040A021C1C03200006032000080320000A0320000C0320000D052000118081052000118089032000050520001180A521070D125111091155115D1165116D1175117D11808511808D1180911180991180A11101000C466F7469612E53716C436C72000005010000000017010012436F7079726967687420C2A920203230303900000801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F77730100142D000000000000000000002E2D0000002000000000000000000000000000000000000000000000202D0000000000000000000000005F436F72446C6C4D61696E006D73636F7265652E646C6C0000000000FF2500204000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100100000001800008000000000000000000000000000000100010000003000008000000000000000000000000000000100000000004800000058400000D00200000000000000000000D00234000000560053005F00560045005200530049004F004E005F0049004E0046004F0000000000BD04EFFE00000100000001000000000000000100000000003F000000000000000400000002000000000000000000000000000000440000000100560061007200460069006C00650049006E0066006F00000000002400040000005400720061006E0073006C006100740069006F006E00000000000000B00430020000010053007400720069006E006700460069006C00650049006E0066006F0000000C020000010030003000300030003000340062003000000044000D000100460069006C0065004400650073006300720069007000740069006F006E000000000046006F007400690061002E00530071006C0043006C00720000000000300008000100460069006C006500560065007200730069006F006E000000000031002E0030002E0030002E003000000044001100010049006E007400650072006E0061006C004E0061006D006500000046006F007400690061002E00530071006C0043006C0072002E0064006C006C00000000004800120001004C006500670061006C0043006F007000790072006900670068007400000043006F0070007900720069006700680074002000A90020002000320030003000390000004C00110001004F0072006900670069006E0061006C00460069006C0065006E0061006D006500000046006F007400690061002E00530071006C0043006C0072002E0064006C006C00000000003C000D000100500072006F0064007500630074004E0061006D0065000000000046006F007400690061002E00530071006C0043006C00720000000000340008000100500072006F006400750063007400560065007200730069006F006E00000031002E0030002E0030002E003000000038000800010041007300730065006D0062006C0079002000560065007200730069006F006E00000031002E0030002E0030002E0030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000C000000403D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
WITH PERMISSION_SET = SAFE
GO
ALTER ASSEMBLY [Fotia.SqlClr]
ADD FILE FROM 0xEFBBBF7573696E672053797374656D3B0D0A7573696E672053797374656D2E446174612E53716C54797065733B0D0A7573696E67204D6963726F736F66742E53716C5365727665722E5365727665723B0D0A0D0A6E616D65737061636520466F7469612E53716C436C720D0A7B0D0A097075626C696320636C61737320466F726D6174537472696E670D0A097B0D0A09095B53716C46756E6374696F6E2844617461416363657373203D20446174614163636573734B696E642E4E6F6E65295D0D0A09097075626C6963207374617469632053716C537472696E6720466F726D6174537472696E67302853716C537472696E6720666F726D61742C206F626A6563742061726730290D0A09097B0D0A09090972657475726E20666F726D61742E49734E756C6C203F2053716C537472696E672E4E756C6C203A20737472696E672E466F726D617428666F726D61742E56616C75652C2053716C54797065546F4E657454797065286172673029293B0D0A09097D0D0A0D0A09095B53716C46756E6374696F6E2844617461416363657373203D20446174614163636573734B696E642E4E6F6E65295D0D0A09097075626C6963207374617469632053716C537472696E6720466F726D6174537472696E67312853716C537472696E6720666F726D61742C206F626A65637420617267302C206F626A6563742061726731290D0A09097B0D0A09090972657475726E20666F726D61742E49734E756C6C203F2053716C537472696E672E4E756C6C203A20737472696E672E466F726D617428666F726D61742E56616C75652C2053716C54797065546F4E65745479706528617267302C206172673129293B0D0A09097D0D0A0D0A09095B53716C46756E6374696F6E2844617461416363657373203D20446174614163636573734B696E642E4E6F6E65295D0D0A09097075626C6963207374617469632053716C537472696E6720466F726D6174537472696E67322853716C537472696E6720666F726D61742C206F626A65637420617267302C206F626A65637420617267312C206F626A6563742061726732290D0A09097B0D0A09090972657475726E20666F726D61742E49734E756C6C203F2053716C537472696E672E4E756C6C203A20737472696E672E466F726D617428666F726D61742E56616C75652C2053716C54797065546F4E65745479706528617267302C20617267312C206172673229293B0D0A09097D0D0A0D0A09095B53716C46756E6374696F6E2844617461416363657373203D20446174614163636573734B696E642E4E6F6E65295D0D0A09097075626C6963207374617469632053716C537472696E6720466F726D6174537472696E67332853716C537472696E6720666F726D61742C206F626A65637420617267302C206F626A65637420617267312C206F626A65637420617267322C206F626A6563742061726733290D0A09097B0D0A09090972657475726E20666F726D61742E49734E756C6C203F2053716C537472696E672E4E756C6C203A20737472696E672E466F726D617428666F726D61742E56616C75652C2053716C54797065546F4E65745479706528617267302C20617267312C20617267322C206172673329293B0D0A09097D0D0A0D0A09097072697661746520737461746963206F626A6563745B5D2053716C54797065546F4E65745479706528706172616D73206F626A6563745B5D2073716C56616C7565290D0A09097B0D0A09090972657475726E2041727261792E436F6E76657274416C6C3C6F626A6563742C206F626A6563743E2873716C56616C75652C20436F6E7665727453716C54797065546F4E657454797065293B0D0A09097D0D0A0D0A09097072697661746520737461746963206F626A65637420436F6E7665727453716C54797065546F4E657454797065286F626A6563742073716C56616C7565290D0A09097B0D0A090909766172206E756C6C616265203D2073716C56616C756520617320494E756C6C61626C653B0D0A090909696628286E756C6C616265203D3D206E756C6C29207C7C20286E756C6C6162652E49734E756C6C29290D0A0909090972657475726E206E756C6C3B0D0A0D0A09090969662873716C56616C75652069732053716C537472696E67290D0A0909090972657475726E20282853716C537472696E672973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C496E743136290D0A0909090972657475726E20282853716C496E7431362973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C496E743332290D0A0909090972657475726E20282853716C496E7433322973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C496E743634290D0A0909090972657475726E20282853716C496E7436342973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C53696E676C65290D0A0909090972657475726E20282853716C53696E676C652973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C446F75626C65290D0A0909090972657475726E20282853716C446F75626C652973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C4461746554696D65290D0A0909090972657475726E20282853716C4461746554696D652973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C4D6F6E6579290D0A0909090972657475726E20282853716C4D6F6E65792973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C446563696D616C290D0A0909090972657475726E20282853716C446563696D616C2973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C426F6F6C65616E290D0A0909090972657475726E20282853716C426F6F6C65616E2973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C42797465290D0A0909090972657475726E20282853716C427974652973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C47756964290D0A0909090972657475726E20282853716C477569642973716C56616C7565292E56616C75653B0D0A09090969662873716C56616C75652069732053716C586D6C290D0A0909090972657475726E20282853716C586D6C2973716C56616C7565292E56616C75653B0D0A09090972657475726E2073716C56616C75653B0D0A09097D0D0A097D0D0A7D
AS N'FormatString.cs'
GO
ALTER ASSEMBLY [Fotia.SqlClr]
ADD FILE FROM 0xEFBBBF7573696E672053797374656D2E5265666C656374696F6E3B0D0A7573696E672053797374656D2E52756E74696D652E496E7465726F7053657276696365733B0D0A0D0A5B617373656D626C793A20417373656D626C795469746C652822466F7469612E53716C436C7222295D0D0A5B617373656D626C793A20417373656D626C794465736372697074696F6E282222295D0D0A5B617373656D626C793A20417373656D626C79436F6E66696775726174696F6E282222295D0D0A5B617373656D626C793A20417373656D626C79436F6D70616E79282222295D0D0A5B617373656D626C793A20417373656D626C7950726F647563742822466F7469612E53716C436C7222295D0D0A5B617373656D626C793A20417373656D626C79436F707972696768742822436F7079726967687420C2A920203230303922295D0D0A5B617373656D626C793A20417373656D626C7954726164656D61726B282222295D0D0A5B617373656D626C793A20417373656D626C7943756C74757265282222295D0D0A5B617373656D626C793A20436F6D56697369626C652866616C7365295D0D0A0D0A5B617373656D626C793A20417373656D626C7956657273696F6E2822312E302E302E3022295D
AS N'Properties\AssemblyInfo.cs'
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString3]    Script Date: 05/23/2009 23:44:28 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString3]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[FormatString3](@format [nvarchar](4000), @arg0 [sql_variant], @arg1 [sql_variant], @arg2 [sql_variant], @arg3 [sql_variant])
RETURNS [nvarchar](4000) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [Fotia.SqlClr].[Fotia.SqlClr.FormatString].[FormatString3]' 
END
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString2]    Script Date: 05/23/2009 23:44:28 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString2]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[FormatString2](@format [nvarchar](4000), @arg0 [sql_variant], @arg1 [sql_variant], @arg2 [sql_variant])
RETURNS [nvarchar](4000) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [Fotia.SqlClr].[Fotia.SqlClr.FormatString].[FormatString2]' 
END
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString1]    Script Date: 05/23/2009 23:44:27 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString1]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[FormatString1](@format [nvarchar](4000), @arg0 [sql_variant], @arg1 [sql_variant])
RETURNS [nvarchar](4000) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [Fotia.SqlClr].[Fotia.SqlClr.FormatString].[FormatString1]' 
END
GO
/****** Object:  UserDefinedFunction [dbo].[FormatString0]    Script Date: 05/23/2009 23:44:27 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FormatString0]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
BEGIN
execute dbo.sp_executesql @statement = N'CREATE FUNCTION [dbo].[FormatString0](@format [nvarchar](4000), @arg0 [sql_variant])
RETURNS [nvarchar](4000) WITH EXECUTE AS CALLER
AS 
EXTERNAL NAME [Fotia.SqlClr].[Fotia.SqlClr.FormatString].[FormatString0]' 
END
GO
